<template>
    <div>
        	<div class="mui-numbox" data-numbox-min='1' >
					<button class="mui-btn mui-btn-numbox-minus" type="button">-</button>
					<input id="test" class="mui-input-numbox" type="number" value="0" @change='countchanged' ref='numbox' />
					<button class="mui-btn mui-btn-numbox-plus" type="button">+</button>
				</div>
    </div>
</template>
<script>
import mui from "../../lib/mui/js/mui.min.js";
export default {
     props:["max"],
     mounted(){//初始化
        mui('.mui-numbox').numbox()
    },
    methods:{
        countchanged(){
          // console.log(this.$refs.numbox.value)
          this.$emit('getcount',parseInt(this.$refs.numbox.value))
        }
    },
    watch:{
       'max':function(newVal,oldVal){
         mui('.mui-numbox').numbox().setOption('max',newVal)
        }
    }
}
</script>
<style lang="scss" scoped>
 .mui-numbox {
  position: relative;
  display: inline-block;
  overflow: hidden;
  width: 120px;
  height: 35px;
  padding: 0 40px;
  vertical-align: top;
  vertical-align: middle;
  border: solid 1px #bbb;
  border-radius: 3px;
  background-color: #efeff4;
  color: #1e1e1e;
  font-size: 14px;
}

</style>
